

*=$0801

 !word main-2, 10 
 !byte $9e
 !text " 2062"
 !byte $00,$00,$00
 
 main:

  sei
        jsr sprites
        lda #$01
        sta $d01a

        ldx #63
sprd    lda spribits,x
        sta $3fc0,x
        lda #1
        sta 1024+1000-63,x
        dex
        bpl sprd
        ;sta $d021
        lda #$ff
        sta $d015
        lda #0
        sta $3fff


        ;Wait for bottom of screen
bottom  lda #250  ;OK: 248 - 251 
bottm1  cmp $d012
        bne bottm1
        ;24-line mode, making VIC forget to show border
        lda #$13 
        sta $d011
        inc $d020
        
        ;Wait for top of screen
zero    lda $d011
        bpl zero
zero2   lda $d011
        bmi zero2
  dec $d020      
        ;Back to 25 lines
        lda #$1b  
        sta $d011
        jmp bottom
        
sprites ldx #$00
        ldy #0
        lda #30
spr1   sta $d000,x
        pha
        lda #$ff
        sta $d001,x
        lda #1
        sta $d027,y
        pla
        clc
        adc #26
        iny
        inx
        inx
        cpx #16
        bne spr1
        
        ldx #0
sprp    lda #$ff
        sta $07f8,x
        txa
        clc
        adc #7
        sta $d027,x
        inx
        cpx #8
        bne sprp
        rts

spribits
  !byte 0,127,0,1,255,192,3,255,224,3,231,224
  !byte 7,217,240,7,223,240,7,217,240,3,231,224
  !byte 3,255,224,3,255,224,2,255,160,1,127,64
  !byte 1,62,64,0,156,128,0,156,128,0,73,0,0,73,0
  !byte  0,62,0,0,62,0,0,62,0,0,28,0 
        

        